/**
 *  Copyright 23.07.2012 oliver.keusemann@googlemail.com
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package de.xelerity.geolessi.preferences;

import java.util.TimeZone;

public class Preferences {

	public static boolean useProxy = false;
	public static String Proxy = "server.proxy.agis.Z";
	public static int ProxyPort = 8080;
	public static int HSISEQUALDISTANCE = 50;
	public static int HSISEQUALDISTANCE1 = 100;
	public static int HSISEQUALDISTANCE2 = 200;

	public static final String ENC_ISO = "ISO-8859-1";
	public static final String ENC_UTF = "UTF-8";

	// public static boolean RUNNNING_IN_APPENGINE = false;

	// Testing only, do not change here
	public static boolean DOHSCLUSTER = true;
	public static boolean DOHSMERGE = true;
	public static boolean DOHSMERGEMITTELCOORD = false;

	public static String RequestMethod = "GET"; // POST

	public static boolean useMemCache = true;

	public static TimeZone Zeitzone = TimeZone.getTimeZone("Europe/Berlin");
	public static long ServerTimeOffset = getServerTimeOffset();

	public static double Germany_WEST = 6.0;
	public static double Germany_EAST = 15.0;
	public static double Germany_NORTH = 55.0;
	public static double Germany_SOUTH = 47.0;

	private static long getServerTimeOffset() {
		long current = new java.util.Date().getTime();
		int edtOffset = TimeZone.getDefault().getOffset(current);
		int gmtOffset = TimeZone.getTimeZone("Europe/Berlin").getOffset(current);
		int hourDifference = (gmtOffset - edtOffset) / (1000 * 60 * 60);
		if (hourDifference != 0) {
			return gmtOffset - edtOffset;
		} else
			return 0L;
	}
}
